<?php

class M_extension extends CI_Model {

    function __construct() {
        parent::__construct();
        $this->load->database();
    }
    
    function get_ad_info($where, $num = '', $offset = '') {
        $this->db->select('ad.*,admin.adminname,adposition.adpositionname,adposition.typeid');
        $this->db->from('ad');
        $this->db->join('admin', 'ad.adminid=admin.adminid', 'left');
        $this->db->join('adposition', 'ad.adpositionid=adposition.adpositionid', 'left');
        $this->db->where($where);
        if ($num) {
            $this->db->limit($num, $offset);
        }
        $query = $this->db->get(); //echo $this->db->last_query();
        return $query->result_array();
    }

    function get_link_info($where, $num = '', $offset = '') {
        $this->db->select('link.*,admin.adminname,config.configid,config.languagever');
        $this->db->from('link');
        $this->db->join('admin', 'link.adminid=admin.adminid', 'left');
        $this->db->join('config', 'link.configid=config.configid', 'left');
        $this->db->where($where);
        if ($num) {
            $this->db->limit($num, $offset);
        }
        $query = $this->db->get(); //echo $this->db->last_query();
        return $query->result_array();
    }

}
